package chunk

import (
	"mig/pkg/types"
)

type Chunk interface {
	Print()
	Records() []*types.Record
	AddRecord(record *types.Record)
	Digest() *types.DigestNode
	Finalize()
}

func NewChunk(algorithm types.Algorithm) Chunk {
	switch algorithm {
	case types.AlgorithmDigest:
		return NewDigestChunk()
	case types.AlgorithmDigestV2:
		return NewDigestV2Chunk()
	case types.AlgorithmBloomFilter:
		return NewBloomFilterChunk()
	case types.AlgorithmCommon:
		return NewCommonChunk()
	default:
		panic("unknown algorithm")
	}
}
